/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cz.cvut.fel.taskpro.data.imanager;

import cz.cvut.fel.taskpro.data.entity.GroupTaskPro;
import cz.cvut.fel.taskpro.data.entity.Kantor;
import cz.cvut.fel.taskpro.data.entity.Student;
import cz.cvut.fel.taskpro.data.entity.Team;
import java.io.Serializable;
import java.util.List;
import javax.ejb.Local;

/**
 * This local interface specify database responsible action of data manager,
 * which is responsible for working with teams.
 *
 * @author Tom
 * @version 1.0.0. beta
 */
@Local
public interface ITeamData extends Serializable {

    /**
     * This method add team to dabase.
     *
     * @param teamToAdd team to add to database.
     */
    public void addTeam(Team teamToAdd);

    /**
     * This method remove team from database based on parameter.
     *
     * @param teamToRemove team to remove from database.
     */
    public void removeTeam(Team teamToRemove);

    /**
     * This method find all teams in db which belongs to study group, which
     * learn kantor in parameter.
     *
     * @param kantor kantor who is responsible for teaching teams.
     * @return all teams in db which belongs to study group, which learn kantor
     * in parameter. Order by team name ascendant. If no result is found then
     * return empty list.
     */
    public List<Team> getTeamByKantor(Kantor kantor);

    /**
     * This method find in database all teams which are parts of groups in
     * parameter. The founded collection has no duplicity teams. Team which is
     * part of one of group from group list in parameter satisfy condition.
     *
     * @param groups groups in which are teams part of. 
     * @return all teams which are parts of groups in parameter. The founded
     * collection has no duplicity teams. Team which is part of one of group
     * from group list in parameter satisfy condition. If no result found then
     * return empty list.
     */
    public List<Team> getTeamByGroup(List<GroupTaskPro> groups);

    /**
     * This method find all students which are in team in group in parameter.
     *
     * @param group group in which are students part of
     * @return all students which are in team in group in parameter. If no
     * result is found then return null. Order by student login ascendant.
     */
    public List<Student> getStudentsInTeamByGroup(GroupTaskPro group);

    /**
     * This method find all team which satisfy condition in parameter. Has
     * specific team name and are part of group in parameter.
     *
     * @param group group in which are team part of
     * @param teamName name of team
     * @return all team which satisfy condition in parameter. Has specific team
     * name and are part of group in parameter. If no result is found then
     * retrun null. Order by team name ascendant
     */
    public List<Team> getTeamByContext(String teamName, GroupTaskPro group);

    /**
     * This method find all teams in which is registred student in parameter.
     *
     * @param student student which is member of returned team.
     * @return all teams in which is registred student in parameter. Order by
     * team name ascendant
     */
    public List<Team> getTeamsByStudent(Student student);

    /**
     * This method update team in parameter to database.
     *
     * @param teamToUpdate team to update to database.
     */
    public void updateTeam(Team teamToUpdate);

    /**
     * This method return team which has registred student in parameter and
     * which is part of study group in parameter
     *
     * @param group group in which is returned team part of.
     * @param studentInTeam student who is member of team.
     * @return team which has registred student in parameter and which is part
     * of study group in parameter. If no result is found then return null.
     * Order by name ascendant.
     */
    public Team getTeamByStudentAndGroup(Student studentInTeam, GroupTaskPro group);
}
